﻿/* 
 *  <copyright file="DebugOnCollisionCmp.cs" company="Wesley Jowitt">
 *  
 *  SobrietyEngine: Copyright (c) 2011 Wesley Jowitt
 *  
 *  This software is distributed under a software license.
 *   * As of the creation time of this file, the license in use is the Microsoft Permissive License (Ms-PL) 
 *    * The license can be viewed at:
 *     * License.Txt in the root folder of this project
 *      * http://sobrietyengine.codeplex.com/license
 *       * http://www.microsoft.com/opensource/licenses.mspx
 *       
 *  </copyright>
 *   */

using System;
using System.Collections.Generic;

using SobrietyEngine.Common;
using SobrietyEngine.Actor;
using SobrietyEngine.Components.Physics;
using SobrietyEngine.Logging;

using FarseerPhysics;
using FarseerPhysics.Collision;
using FarseerPhysics.Dynamics;
using FarseerPhysics.Dynamics.Contacts;

namespace SobrietyEngine.Components.Physics.OnCollision
{
    public class DebugOnCollisionCmp:OnCollisionBase, SobrietyEngine.Components.IComponent
    {
        public DebugOnCollisionCmp()
            : base()
        {
        }

        override public bool OnCollision(Fixture f1, Fixture f2, Contact contact)
        {
            IActor a1 = (IActor)f1.Body.UserData;
            IActor a2 = (IActor)f2.Body.UserData;

            Logger.GetSingleton().WriteLine(a1.Guid.Value + " collided with " + a2.Guid.Value, LogMessageTypes.Debugging);
            return true;
        }

        public override void OnSeperation(Fixture fixtureA, Fixture fixtureB)
        {
            throw new NotImplementedException();
        }
    }
}
